<?php
require_once __DIR__.'/PHPExcel/Classes/PHPExcel.php';
/*$excel=new PHPExcel();
$sheet=$excel->setActiveSheetIndex(0);//设置当前的sheet,工作簿
$sheet->setTitle('work1');
//$arr=range('A',"Z");
//$arr2=array(1,2,3,4,5,6,7,8,9);
//foreach ($arr2 as $key=>$value){
//    $sheet->setCellValue("$arr[$key]1",$value);
//}
$sheet->setCellValue("A1",mb_convert_encoding('中国',"GBK","UTF-8"));
$newsheet=$excel->createSheet(1);
$newsheet->setTitle('work2');
$newsheet->setCellValue('A1',4567);
//header('Content-Type: application/vnd.ms-excel');
//header('Content-Disposition: attachment;filename=1.xlsx');
//header('Cache-Control: max-age=0');
$create=PHPExcel_IOFactory::createWriter($excel,'Excel2007');//创建当前的excel文件
$create->save(__DIR__.'/2.xlsx');//路径 保存在本地   后缀名是xlsx
//$create->save('php://output');//使用输出流
echo "<a href='/2.xlsx'>下载</a>";*/
//读取excel
$excel=PHPExcel_IOFactory::createReader('Excel2007');
$read=$excel->load(__DIR__.'/2.xlsx');
$sheet=$read->getSheet(1);
echo "列：".$sheet->getHighestColumn();
echo "行：".$sheet->getHighestRow();
echo "<br/>";
echo $sheet->getCell('A1')->getValue();

